1 package net.sourceforge.selfesteem.applet.test;
2
3 import junit.framework.TestCase;
4 import net.sourceforge.selfesteem.applet.Parser;
5 import net.sourceforge.selfesteem.applet.Source;
6
7 import javax.swing.tree.MutableTreeNode;
8 import java.util.HashMap;
9 import java.util.Map;
10
11 public class ParserTest extends TestCase {
12 public ParserTest(String s) {
13 super(s);
14 }
15
16 public void testParsingParametersIntoTreeNodes() {
17 final Map map = new HashMap();
18 map.put("lines", "5");
19 map.put("line1", "blue skies");
20 map.put("line2", "-smiling at me");
21 map.put("line3", "-nothing but blue skies");
22 map.put("line4", "--do I see");
23 map.put("line5", "-never seen the night");
24
25 Parser parser = new Parser();
26 MutableTreeNode node = parser.parse(new Source() {
27 public String getParameter(String name) {
28 return (String) map.get(name);
29 }
30 });
31
32 assertEquals("blue skies", node.toString());
33 assertEquals(3, node.getChildCount());
34 assertEquals("smiling at me", node.getChildAt(0).toString());
35 }
36
37 }
This page was automatically generated by Maven